# 求一个数的阶乘
class JieChengCount(object):
    def __init__(self,n):
        self.n = n
    # 阶乘求积
    def jc(self,n):
        result = 1
        if n == 0:
            return result
        else:
            for i in range(1, n + 1):  # 1到n的积
                result *= i
            return result

    # 求和
    def count(self):
        count = 0
        for i in range(0, int(self.n) + 1):  # 0到num的和
            count += self.jc(i)  # 调用求阶乘
        print("1-{0}的阶乘求和 = {1}".format(self.n, count))

def main():
    num = input("input a number:")
    jieChengCount = JieChengCount(int(num))  #初始化并传参
    jieChengCount.count()

if __name__ == '__main__':
    main()